<template>
  <scroll id="tab-menu">
    <div class="menu">
      <div v-for="(item,index) in childCategories" :key="index" class="menu-item" :class="{active: index === currentIndex}"
        @click="menuClick(index)">
        {{item.title}}
      </div>
    </div>
  </scroll>
</template>

<script>
import Scroll from "@/components/common/scroll/Scroll";

export default {
  name: "TabMenu",
  components: {
    Scroll
  },
  data() {
    return {
      currentIndex: 0
    }
  },
  props: {
    childCategories: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    menuClick(index) {
      this.currentIndex = index;
      this.$emit('selectItem',index)
    }
  }
}
</script>

<style scoped>
.menu {
}
#tab-menu {
  height: 45px;
  height: 600px;
  text-aligh: center;
  font-size: 17px;
}
.menu-item {
  height: 45px;
  line-height: 45px;
  text-align: center;
  font-size: 17px;
}
.active {
  color: var(--color-tint)
}
</style>
